﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace FusionDotNet
{
    internal class TableBuilder
    {
        internal static void AddColumnHeaders(string[] headers, DataTable table)
        {
            foreach (string header in headers)
            {
                table.Columns.Add(header);
            }
        }

        internal static Type ConvertToType(string columnType)
        {
            switch (columnType.ToLower())
            {
                case "number": return typeof(decimal);
                case "string": return typeof(string);
                case "location": return typeof(string);
                case "datetime": return typeof(DateTime);
                default:
                    return typeof(string);
            }
        }

        internal static string ConvertFromType(Type type)
        {
            switch (type.Name)
            {
                case "decimal": return "number";
                case "string": return "string"; ;
                case "Location": return "location";
                case "DateTime": return "datetime"; 
                default:
                    return "string";
            }           
        }
    }
}
